import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

# 这里导入你自己的数据
# ......
# ......
# x_axix，train_pn_dis这些都是长度相同的list()

x=range(1,11)

epochfile = '../traceData/add_epoch_data.txt'
noisefile = '../traceData/add_noise_data.txt'
normalfile = '../traceData/normal_data.txt'

yepoch=[]
ynoise=[]
ynormal = []

file1 = open(epochfile,'r')
file2 = open(noisefile,'r')
file3 = open(normalfile,'r')

for line in file1.readlines():
    y = line.split(',')[2][12:]
    yepoch.append(float(y))

for line in file2.readlines():
    y = line.split(',')[2][12:]
    ynoise.append(float(y))

for line in file3.readlines():
    y = line.split(',')[2][12:]
    ynormal.append(float(y))

# 开始画图
sub_axix = filter(lambda x: x % 200 == 0, x)
#plt.ylim(0,1)
plt.title('Result Analysis')

plt.plot(x, yepoch, color='green', label='epoch')
plt.plot(x, ynoise, color='red', label='iteration')
plt.plot(x, ynormal, color='skyblue', label='normal')

plt.legend()  # 显示图例

plt.xlabel('epoch')
plt.ylabel('accurate')
plt.show()
plt.savefig('test')
